import Vue from 'vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
import JsonExcel from 'vue-json-excel'
import { createRoutes } from '@/utils/routesUtil.js'
Vue.prototype.imgUrl = 'http://64.64.232.142/:8082/'
Vue.config.productionTip = false
Vue.use(ElementUI)
Vue.component('downloadExcel', JsonExcel)
// 声明一个vm实例对象
let app = new Vue({
  router,
  store,
  render: h => h(App)
})
// 挂载
app.$mount('#app')
// 判断也没有菜单数据，解决F5刷新页面，没路由信息的问题
if (store.state.addRoutesState === false && sessionStorage.getItem('menu')) {
  createRoutes(JSON.parse(sessionStorage.getItem('menu')), app) //app,就是组件实例对象
}
